/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.jili.ubert.dao.db;

import java.io.Serializable;
import com.baidu.bjf.remoting.protobuf.Codec;
import com.baidu.bjf.remoting.protobuf.ProtobufProxy;
import com.baidu.bjf.remoting.protobuf.annotation.Protobuf;
import com.jili.ubert.code.CodeTool;
import java.io.IOException;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author dragon
 */
@Entity
@Table(name = "obj_pricetick")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "ObjPriceTick.findAll", query = "SELECT o FROM ObjPriceTick o"),
    @NamedQuery(name = "ObjPriceTick.findById", query = "SELECT o FROM ObjPriceTick o WHERE o.id = :id"),
    @NamedQuery(name = "ObjPriceTick.findByClassCode", query = "SELECT o FROM ObjPriceTick o WHERE o.classCode = :classCode"),
    @NamedQuery(name = "ObjPriceTick.findByMarketCode", query = "SELECT o FROM ObjPriceTick o WHERE o.marketCode = :marketCode"),
    @NamedQuery(name = "ObjPriceTick.findByUnderlyingCode", query = "SELECT o FROM ObjPriceTick o WHERE o.underlyingCode = :underlyingCode"),
    @NamedQuery(name = "ObjPriceTick.findByLowerRange", query = "SELECT o FROM ObjPriceTick o WHERE o.lowerRange = :lowerRange"),
    @NamedQuery(name = "ObjPriceTick.findByUpperRange", query = "SELECT o FROM ObjPriceTick o WHERE o.upperRange = :upperRange"),
    @NamedQuery(name = "ObjPriceTick.findByTick", query = "SELECT o FROM ObjPriceTick o WHERE o.tick = :tick"),
    @NamedQuery(name = "ObjPriceTick.findByAlterUserID", query = "SELECT o FROM ObjPriceTick o WHERE o.alterUserID = :alterUserID"),
    @NamedQuery(name = "ObjPriceTick.findByCreateTime", query = "SELECT o FROM ObjPriceTick o WHERE o.createTime = :createTime"),
    @NamedQuery(name = "ObjPriceTick.findByTimeStamp", query = "SELECT o FROM ObjPriceTick o WHERE o.timeStamp = :timeStamp")})
public class ObjPriceTick implements Serializable {
	public static byte[] EnCode(ObjPriceTick msg) throws IOException {
		Codec<ObjPriceTick> Lcode = ProtobufProxy.create(ObjPriceTick.class);
		return Lcode.encode(msg);
	}
	public static ObjPriceTick DeCode(byte[] data) throws IOException {
	Codec<ObjPriceTick> Lcode = ProtobufProxy.create(ObjPriceTick.class);
		return Lcode.decode(data);
	}

    private static final long serialVersionUID = 1L;
    @Id
    //@GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    @Protobuf
	private Integer id;
    @Basic(optional = false)
    @Column(name = "ClassCode")
    @Protobuf
	private String classCode;
    @Basic(optional = false)
    @Column(name = "MarketCode")
    @Protobuf
	private String marketCode;
    @Column(name = "UnderlyingCode")
    @Protobuf
	private String underlyingCode;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(name = "LowerRange")
    @Protobuf
	private Float lowerRange;
    @Column(name = "UpperRange")
    @Protobuf
	private Float upperRange;
    @Column(name = "Tick")
    @Protobuf
	private Float tick;
    @Column(name = "AlterUserID")
    @Protobuf
	private String alterUserID;
    @Column(name = "CreateTime")
    @Temporal(TemporalType.TIMESTAMP)
    private Date createTime;
	//@Protobuf
//tprivate long createTimeL;
    @Column(name = "TimeStamp")
    @Temporal(TemporalType.TIMESTAMP)
    private Date timeStamp;
	//@Protobuf
	//private long timeStampL;

    public ObjPriceTick() {
    }

    public ObjPriceTick(Integer id) {
        this.id = id;
    }

    public ObjPriceTick(Integer id, String classCode, String marketCode) {
        this.id = id;
        this.classCode = classCode;
        this.marketCode = marketCode;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getClassCode() {
        return classCode;
    }

    public void setClassCode(String classCode) {
        this.classCode = classCode;
    }

    public String getMarketCode() {
        return marketCode;
    }

    public void setMarketCode(String marketCode) {
        this.marketCode = marketCode;
    }

    public String getUnderlyingCode() {
        return underlyingCode;
    }

    public void setUnderlyingCode(String underlyingCode) {
        this.underlyingCode = underlyingCode;
    }

    public Float getLowerRange() {
        return lowerRange;
    }

    public void setLowerRange(Float lowerRange) {
        this.lowerRange = lowerRange;
    }

    public Float getUpperRange() {
        return upperRange;
    }

    public void setUpperRange(Float upperRange) {
        this.upperRange = upperRange;
    }

    public Float getTick() {
        return tick;
    }

    public void setTick(Float tick) {
        this.tick = tick;
    }

    public String getAlterUserID() {
        return alterUserID;
    }

    public void setAlterUserID(String alterUserID) {
        this.alterUserID = alterUserID;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
		//this.createTimeL = CodeTool.DateToLong(createTime);
    }

    public Date getTimeStamp() {
        return timeStamp;
    }

    public void setTimeStamp(Date timeStamp) {
        this.timeStamp = timeStamp;
		//this.timeStampL = CodeTool.DateToLong(timeStamp);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof ObjPriceTick)) {
            return false;
        }
        ObjPriceTick other = (ObjPriceTick) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.jili.ubert.dao.db.ObjPriceTick[ id=" + id + " ]";
    }
    
}
